#include "contacts.h"

void menu(){
    printf("**************************\n");    
    printf("***  1.Add    2.Del    ***\n");    
    printf("***  3.Search 4.modify ***\n");    
    printf("***  5.show   6.sort   ***\n");
    printf("***  0.exit            ***\n");
    printf("**************************\n");
}
int main(){
    PeoCont con;
    InitContacts(&con);
    int input = 0;
    do
    {
        menu();
        printf("请输入您的选择:>");
        scanf("%d", &input);
        switch (input)
        {
        case 1:
            AddContacts(&con);
            sleep(1);
            system("clear");
            break;
        case 2:
            DelContacts(&con);
            sleep(1);
            system("clear");
            break;
        case 3:
            SearchContacts(&con);
            break;
        case 4:
            ModifyContacts(&con);
            sleep(1);
            system("clear");
            break;
        case 5:
            ShowContacts(&con);
            break;
        case 6:
            SortContacts(&con);
            sleep(1);
            system("clear");
            break;
        case 0:
            system("clear");
            break;
        default:
            printf("输入错误\n");
            sleep(1);
            system("clear");
            break;
        }
    } while (input);
        
    return 0;
}